/**
 * 自动引入API
 * */
import AutoImport from 'unplugin-auto-import/vite';

import { ArcoResolver } from 'unplugin-vue-components/resolvers';
import IconsResolver from 'unplugin-icons/resolver';

import { layoutsResolver } from '../utils';

export function configAutoImport() {
  return AutoImport({
    imports: [
      'vue',
      'vue-router',
      'pinia',
      '@vueuse/core',
      {
        dayjs: [['default', 'dayjs']],
        'lodash-es': ['cloneDeep', 'omit', 'pick'],
        '@/hooks': ['useModal'],
      },
    ],
    resolvers: [
      ArcoResolver({
        resolveIcons: {
          enable: true,
        },
      }),
      IconsResolver({
        enabledCollections: [],
      }),
      layoutsResolver(),
    ],
    eslintrc: {
      enabled: true,
      filepath: './config/unplugin/.eslintrc-auto-import.json',
    },
    dts: './config/unplugin/auto-imports.d.ts',
  });
}
